You are currently viewing the Homey Apps SDK v2 documentation. New apps should use Homey Apps SDK v3 ››

Pincode

"template": "pincode"

This pair template shows a pincode input. When the pincode is correct, it will proceed to the next view.

/drivers/<driver_id>/driver.js

const Homey = require('homey');

class MyDriver extends Homey.Driver {

	onPair( socket ) {
  	socket.on('pincode', ( pincode, callback ) => {
    	if( pincode === '1234' ) {
      	callback( null, true );
      } else {
        callback( null, false );
      }
  	});
	}

}

Options

Key Type Default Description
type string "number" Either number or text
length number 4 The number of characters
hint i18n-object ""
title i18n-object "Enter pincode:"